# -*- coding:utf-8 -*-
import struct,codecs
fp=open('text.txt','rb')
dat=fp.read()
size=len(dat)
charlist=[]
for i in xrange(2,size,2):
    fp.seek(i)
    value=struct.unpack('H',fp.read(2))[0]
    fp.seek(i)
    value2=struct.unpack('>H',fp.read(2))[0]
    table='%04x=%s'%(value2,unichr(value))
    if table not in charlist:
        charlist.append(table)
fp.close()

charlist.sort()
tar=codecs.open('font.tbl','wb','utf16')
for item in charlist:
    print item
    tar.write(item+'\r\n')
tar.close()